﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.ComponentModel;

namespace CRM.Entity
{
    /// <summary>
    /// 实体抽象类
    /// </summary>    
    [DataContract]
    public class BaseEntity : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        protected void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
        EntityState _entity = EntityState.UnChange;
        /// <summary>
        /// 实体状态
        /// </summary>
        [DataMember]
        public EntityState entityState
        {
            get { return _entity; }
            set
            {
                _entity = value;
            }
        }
    }
    [DataContract]
    public enum EntityState
    {
        /// <summary>
        /// 未改变
        /// </summary>
        [EnumMember]
        UnChange = 0,
        /// <summary>
        /// 已改变
        /// </summary>
        [EnumMember]
        Changed = 1,
        /// <summary>
        /// 新增
        /// </summary>
        [EnumMember]
        Add = 2,
        /// <summary>
        /// 已删除
        /// </summary>
        [EnumMember]
        Deleted = 3
    }
}
